<%
var startPage = 1;
if (totalPage <= 0||currentPage > totalPage)
startPage = currentPage - 4;
if (startPage < 1)
startPage = 1;

var endPage = currentPage + 4;

if (endPage > totalPage)
endPage = totalPage;

if (currentPage <= 8)
startPage = 1;

if (totalPage - currentPage < 8)
endPage = totalPage;
%>

<div class="pagination">
    <%if (currentPage == 1){%>
    <span class="disabled prev_page">上页</span>
    <%}else{%>
    <a href="${actionUrl}${currentPage - 1}${urlParas!}" class="prev_page">上页</a>
    <%}if (currentPage > 8){%>
    <a href="${actionUrl}1${urlParas!}">1</a>
    <a href="${actionUrl}2${urlParas!}">2</a>
    <span class="gap">…</span>

    <%}
    for (var i = startPage; i < endPage; i++)
    if(currentPage == i){
    %>
    <span class="current">${i}</span>
    <%}else{%>
    <a href="${actionUrl}${i}${urlParas!}">${i}</a>
    <%}%>

    <%if (totalPage - currentPage >= 8){%>
    <span class="gap">…</span>
    <a href="${actionUrl}${totalPage - 1}${urlParas!}">${totalPage - 1}</a>
    <a href="${actionUrl}${totalPage}${urlParas!}">${totalPage}</a>
    <%}%>

    <%if (currentPage == totalPage){%>
    <span class="disabled next_page">下页</span>
    <%}else{%>
    <a href="${actionUrl}${currentPage + 1}${urlParas!}" class="next_page" rel="next">下页</a>
    <%}%>
</div>